'use strict';

/**
 * @name snPaas
 * @description
 * # suning paas console
 *
 * Main module of the application.
 */
angular.module('snPaas_om', [
    'ui.router',
    'ngDialog',
    'ngFileUpload',
    'spLoad',
    'snPaas.control'
    // ,'snPaasDev'
  ])
  // .constant('baseUrl', {'static':'/cloudManage/','ajax':''})
  .constant('baseUrl', {'static':'/','ajax':''})

  // .value('baseUrl', 'http://localhost:8800/')
  .run(['$rootScope','$state','$stateParams','baseUrl',function($rootScope,$state,$stateParams,baseUrl){
    $rootScope.baseObj = baseUrl;
    $rootScope.$state = $state;
    $rootScope.$stateParams = $stateParams;

  }])
  .config(['$stateProvider','$urlRouterProvider','baseUrl',function ($stateProvider,$urlRouterProvider,baseUrl) {
    $urlRouterProvider.when("","/solutions")
    .when("/users","/users/list")
    .when("/mysql","/mysql/list")
    .when("/versions","/versions/cf")
    .when("/","/solutions")
    .when("/monitor","/monitor/cf/list")
    .when("/monitor/cf","/monitor/cf/list")
    .when("/monitor/mysql","/monitor/mysql/list");

    $stateProvider
      .state('solutions',{
        url:'/solutions',
        templateUrl: baseUrl.static+'template/views/cluster.html',
        controller: 'ClusterCtrl'
      })
      .state('soldetail',{
        url:'/soldetail/:solId',
        templateUrl: baseUrl.static+'template/views/soldetail.html',
        controller: 'SolutionDetailCtrl'
      })
      .state('mysql',{
        url:'/mysql',
        templateUrl: baseUrl.static+'template/views/wrap.html',
      })
      .state('mysqlList',{
        url:'/list',
        templateUrl: baseUrl.static+'template/views/mysqlList.html',
        controller: 'MysqlListCtrl',
        parent: 'mysql'
      })
      .state('mysqlDetail',{
        url:'/detail/:id',
        templateUrl: baseUrl.static+'template/views/mysqlDetail.html',
        controller: 'MysqlDetailCtrl',
        parent: 'mysql'
      })
      .state('Users',{
        url:'/users',
        templateUrl: baseUrl.static+'template/views/user.html'
      })
      .state('userList',{
        parent:'Users',
        url:'/list',
        templateUrl: baseUrl.static+'template/views/userlist.html',
        controller: 'UsersCtrl'
      })
      .state('userDetail',{
        url:'/detail/:id',
        templateUrl: baseUrl.static+'template/views/userDetail.html',
        controller: 'UsersDetailCtrl',
        parent: 'Users'
      })
      .state('versions',{
        url:'/versions',
        templateUrl: baseUrl.static + 'template/views/wrap.html'
      })
      .state('cfVersions',{
        url:'/cf',
        parent: 'versions',
        templateUrl: baseUrl.static + 'template/views/versions.html',
        controller: 'VersionsCtrl'       
      })
      .state('mysqlVersions',{
        url:'/mysql',
        parent: 'versions',
        templateUrl: baseUrl.static + 'template/views/mysqlVersions.html',
        controller: 'MysqlVersionsCtrl'       
      })
      .state('workorder',{
        url:'/workorder',
        templateUrl: baseUrl.static + 'template/views/workorder.html',
        controller: 'WorkorderCtrl'
      })


      .state('monitor',{
        url:'/monitor',
        templateUrl: baseUrl.static + 'template/views/monitorWrap.html',
      })


      .state('monitorCf',{
        url:'/cf',
        parent:'monitor',
        templateUrl: baseUrl.static + 'template/views/wrap.html',
      })
      .state('monitorCfList',{
        url:'/list',
        parent:'monitorCf',
        templateUrl: baseUrl.static + 'template/views/monitorCfList.html',
        controller: 'ClusterCtrl'        
      })

       .state('monitorCompList',{
        url:'/cluster/:id',
        parent:'monitorCf',
        templateUrl: baseUrl.static + 'template/views/monitor.html',
        controller: 'MonitorCtrl'        
      })


      .state('monitorComponent',{
        url:'/component/:id/:name',
        parent:'monitorCf',
        templateUrl: baseUrl.static + 'template/views/componentMonitor.html',
        controller: 'ComponentMonitCtrl'        
      })




      .state('monitorMysqlList',{
        url:'/list',
        parent:'monitorMysql',
        templateUrl: baseUrl.static + 'template/views/mysqlMonitor.html',
        controller: 'MysqlListCtrl'        
      })
      .state('monitorMysqlCompList',{
        url:'/complist/:id',
        parent:'monitorMysql',
        templateUrl: baseUrl.static + 'template/views/mysqlComp.html',
        controller: 'MysqlCompCtrl'        
      })
      .state('monitorMysqlCompDetail',{
        url:'/compdetail/:id/:comp',
        parent:'monitorMysql',
        templateUrl: baseUrl.static + 'template/views/mysqlComponentMonitor.html',
        controller: 'MysqlCompDetailCtrl'        
      })
      .state('monitorMysql',{
        url:'/mysql',
        parent:'monitor',
        templateUrl: baseUrl.static + 'template/views/wrap.html'
      })
     
      ;
  }])
  ;

